<?php 
function kirki_header()
{
    Kirki::add_section( 'header', array(
    'priority'    => 20,
    'title'       => esc_html__( '页头', 'ifan_theme' ),
    'panel'       => 'options',
) );

Kirki::add_field( 'ifan_theme_config', array(
    'type'          => 'radio-image',
    'settings'      => 'nav-style',
    'label'         => esc_html__( '菜单样式', 'ifan_theme' ),

    'section'       => 'header',
    'default'       => 'nav-style1',
    'priority'    => 1,
    'choices'     => array(
        'nav-style1'    => get_template_directory_uri() . '/functions/images/layout-off.png',
        'nav-style2'    => get_template_directory_uri() . '/functions/images/col-1c.png',
        'nav-style3'    => get_template_directory_uri() . '/functions/images/col-2cl.png',
        'custom'    => get_template_directory_uri() . '/functions/images/col-2cl.png',
    ),
) );
Kirki::add_field( 'ifan_theme_config', [
    'type'        => 'dimension',
    'settings'    => 'nav-padding',
    'label'       => esc_html__( '导航菜单间距', 'ifan_theme' ),
    'description' => esc_html__( 'Description Here.', 'ifan_theme' ),
    'section'     => 'header',
    'priority'    => 2,
    'default'     => '10px',
    'active_callback' => [
    [
        'setting'  => 'nav-style',
        'operator' => '==',
        'value'    => 'custom',
    ]
    ],
] );

Kirki::add_field( 'ifan_theme_config', [
    'type'        => 'radio',
    'settings'    => 'nav-width',
    'label'       => esc_html__( '菜单宽度', 'ifan_theme' ),
    'section'     => 'header',
    'default'     => 'full',
    'priority'    => 3,
    'choices'     => [
        'full'   => esc_html__( '全屏宽度', 'ifan_theme' ),
        'container' => esc_html__( '固定宽度', 'ifan_theme' ),

    ],
    'active_callback' => [
    [
        'setting'  => 'nav-style',
        'operator' => '==',
        'value'    => 'custom',
    ]
    ],
] );

Kirki::add_field( 'ifan_theme_config', [
    'type'        => 'radio',
    'settings'    => 'nav-position',
    'label'       => esc_html__( '菜单位置', 'ifan_theme' ),
    'section'     => 'header',
    'default'     => 'avg-content',
    'priority'    => 4,
    'choices'     => [
        'left'   => esc_html__( '左对齐', 'ifan_theme' ),
        'right' => esc_html__( '右对齐', 'ifan_theme' ),
        'avg-center' => esc_html__( '平均居中', 'ifan_theme' ),
        'avg-center-top' => esc_html__( '平均居中并吸附顶部', 'ifan_theme' ),

    ],
    'active_callback' => [
    [
        'setting'  => 'nav-style',
        'operator' => '==',
        'value'    => 'custom',
    ]
    ],
] );



Kirki::add_field( 'ifan_theme_config', [
    'type'        => 'multicolor',
    'settings'    => 'nav-bg-color',
    'label'       => esc_html__( '菜单背景颜色', 'ifan_theme' ),
    'section'     => 'header',
    'priority'    => 5,
    'choices'     => [
        'link'    => esc_html__( '默认', 'ifan_theme' ),
        'hover'   => esc_html__( '鼠标经过', 'ifan_theme' ),
        'active'  => esc_html__( '当前激活', 'ifan_theme' ),
    ],
    'default'     => [
        'link'    => '#0088cc',
        'hover'   => '#00aaff',
        'active'  => '#00ffff',
    ],
    'active_callback' => [
    [
        'setting'  => 'nav-style',
        'operator' => '==',
        'value'    => 'custom',
    ]
],
] );

Kirki::add_field( 'ifan_theme_config', [
    'type'        => 'multicolor',
    'settings'    => 'nav-text-color',
    'label'       => esc_html__( '菜单字体颜色', 'ifan_theme' ),
    'section'     => 'header',
    'priority'    => 6,
    'choices'     => [
        'link'    => esc_html__( '默认', 'ifan_theme' ),
        'hover'   => esc_html__( '鼠标经过', 'ifan_theme' ),
        'active'  => esc_html__( '当前激活', 'ifan_theme' ),
    ],
    'default'     => [
        'link'    => '#0088cc',
        'hover'   => '#00aaff',
        'active'  => '#00ffff',
    ],
    'active_callback' => [
    [
        'setting'  => 'nav-style',
        'operator' => '==',
        'value'    => 'custom',
    ]
    ],

] );
// Header: Social Links
Kirki::add_field( 'ifan_theme_config', array(
    'type'          => 'switch',
    'settings'      => 'header-social',
    'label'         => esc_html__( '顶部显示社会化图标', 'ifan_theme' ),
    'description'   => esc_html__( '社会化链接在 主题定制->社会化链接中填写', 'ifan_theme' ),
    'section'       => 'header',
    'default'       => 'on',
) );
Kirki::add_field( 'ifan_theme_config', array(
    'type'          => 'switch',
    'settings'      => 'header-search',
    'label'         => esc_html__( '菜单栏搜索框', 'ifan_theme' ),
    'description'   => esc_html__( '在导航菜单后面添加搜索图标', 'ifan_theme' ),
    'section'       => 'header',
    'default'       => 'on',
) );

}
 ?>